import { lazy } from "react"
//引入自定义图标方法
import { createFromIconfontCN } from '@ant-design/icons';
const MyIcon = createFromIconfontCN({
    scriptUrl: '//at.alicdn.com/t/c/font_2402710_3adh8it1lnz.js', // 在 iconfont.cn 上生成
});

let Login = lazy(() => import("../pages/Login"))
let Page404 = lazy(() => import("../pages/Page404"))
let PayManagement = lazy(() => import("../pages/payManagement"))
let PayType = lazy(() => import("../pages/payManagement/payType"))
let PictureManagement = lazy(() => import("../pages/pictureManagement"))
let CarouselManagement = lazy(() => import("../pages/pictureManagement/carouselManagement"))
let ProductManagement = lazy(() => import("../pages/productManagement"))
let Category = lazy(() => import("../pages/productManagement/category"))
let ProductList = lazy(() => import("../pages/productManagement/productList"))
let TransactionManagement = lazy(() => import("../pages/transactionManagement"))
let TransactionMoney = lazy(() => import("../pages/transactionManagement/transactionMoney"))
let Order = lazy(() => import("../pages/transactionManagement/order"))
let Refound = lazy(() => import("../pages/transactionManagement/refound"))
let LayoutBase = lazy(() => import("@/layout/content"))
let Home = lazy(() => import("@/pages/Home"))

//引入布局组件
//声明路由配置
let routes: Array<Iroute> = [
    {
        path: "/login",
        element: <Login />
    },
    {
        path: "*",
        element: <Page404 />
    },
    {
        path: "/",
        element: <LayoutBase />,
        children: [

            {
                path: "payManagement",
                element: <PayManagement />,
                key: 'payManagement',
                label: "支付管理",
                icon: <MyIcon type="icon-zhifu" />,
                children: [
                    {
                        path: "payType",
                        element: <PayType />,
                        key: "payType",
                        label: "支付类型",
                        icon: <MyIcon type="icon-zhifupingtai-paypal" />
                    }
                ]
            },
            {
                path: "pictureManagement",
                element: <PictureManagement />,
                key: "pictureManagement",
                label: "图片管理",
                icon: <MyIcon type="icon-tupian" />,
                children: [
                    {
                        path: "carouselManagement",
                        element: <CarouselManagement />,
                        key: "carouselManagement",
                        label: "轮播图管理",
                        icon: <MyIcon type="icon-drxx70" />

                    }
                ]
            },
            {
                path: "transactionManagement",
                element: <TransactionManagement />,
                key: "transactionManagement",
                label: "交易管理",
                icon: <MyIcon type="icon-biaoqiankuozhan_jiaoyi-195" />,
                children: [
                    {
                        path: "order",
                        element: <Order />,
                        key: "order",
                        label: "订单管理",
                        icon: <MyIcon type="icon-cangpeitubiao_dingdan" />,

                    },
                    {
                        path: "refound",
                        element: <Refound />,
                        key: "refound",
                        label: "退款管理",
                        icon: <MyIcon type="icon-tuikuan" />,
                    },
                    {
                        path: 'transactionMoney',
                        element: <TransactionMoney />,
                        key: "transactionMoney",
                        label: "交易金额",
                        icon: <MyIcon type="icon-icon_A" />
                    }
                ]
            },
            {
                path: 'productManagement',
                element: <ProductManagement />,
                key: "productManagement",
                label: "产品管理",
                icon: <MyIcon type="icon-shangpinguanli" />,
                children: [
                    {
                        path: 'productList',
                        element: <ProductList />,
                        key: "productList",
                        label: "产品列表",
                        icon: <MyIcon type="icon-liebiao" />
                    },
                    {
                        path: 'category',
                        element: <Category />,
                        key: "category",
                        label: "产品类目",
                        icon: <MyIcon type="icon-tubiaozhizuomoban" />
                    }
                ]
            },
            {
                path: "home",
                element: <Home />,
                key: "home",
                label: "系统首页",
                icon: <MyIcon type="icon-biaoqianA01_shouye-261" />
            },
        ]
    }
]

export default routes